Conventionally, in order to represent an accumulation of snow in three-dimensional image processing, a method is employed for positioning, in a virtual space, a polygonal model in shape corresponding to the shape of the snow surface of the accumulation of snow (see Japanese Laid-Open Patent Publication No. 2006-285510, for example).
However, in order to position, in the virtual space, the polygonal model in shape corresponding to the shape of the snow surface of the accumulation of snow as described above, the more complex the shape of the snow surface is, the more complex the shape of the polygonal model also is. As a result, the number of polygons included in the polygonal model is extremely large, and therefore increases the processing load of the computer.
Therefore, certain example embodiments provide an image processing program and an image processing apparatus, which are capable of easily drawing, in three-dimensional image processing, the surface shape of a three-dimensional object, such as an accumulation of snow, soil, sand, or bricks, positioned in a virtual space, regardless of the shape of the object.
The reference numerals and the figure numbers in parentheses recited below indicate an example of the correspondence with the drawings in order to aid in understanding certain example embodiments and are not intended to limit the scope of the present invention in any way.
In certain example embodiments a computer-readable storage medium having stored therein an image processing program (40) for drawing a three-dimensional object (e.g., an accumulation of snow, soil, sand, or bricks) positioned in a virtual space is provided. The image processing program is a computer program for causing a computer (10, 11b) to execute a polygon data reading step, a height map reading step, a visible region determining step (S46), and a drawing step (S48). The polygon data reading step is a step of reading, from storage means (11e, 12), multilayer polygon data (43) for constructing multilayer polygonal models including a plurality of polygonal models positioned in layers. The height map reading step is a step of reading, from the storage means (11e, 12), a height map (30) including height data values arranged in a two-dimensional array, the height data values each indicating a height of each position which is provided on the three-dimensional object to be drawn and corresponds to each position provided on the multilayer polygonal models. The visible region determining step is a step of determining, by comparing a height of a layer of the multilayer polygonal models to the height data value of a position provided on the height map, whether a position provided on the layer corresponding to the position provided on the height map is to be displayed in a visible manner. The drawing step is a step of, based on a determination made in the visible region determining step that a region is to be displayed in a visible manner, drawing the region in a predetermined color.
Note that the image processing program may further cause the computer to execute a height changing step (S16, S18, S20) of changing the height data values of at least a portion of positions provided on the height map. Thus, it is possible to change the height of the three-dimensional object to be drawn.
Further, the image processing program may further cause the computer to execute a moving object positioning step (S10) of positioning, in the virtual space, a moving object (31) which is an object different from the three-dimensional object, and to execute a movement control step of moving the moving object. The height changing step may include an object interfering step (S16) of changing the height data value of a position (Pc) which is provided on the height map and corresponds to a current position of the moving object. Thus, it is possible to change the height of a position (or a region) provided on the three-dimensional object and corresponding to the current position of the moving object.
Further, the object interfering step may include: a step (S12) of obtaining a position which is provided on the multilayer polygonal models and corresponds to the current position of the moving object; a step (S14) of obtaining, based on mapping information (FIG. 16) indicating which position provided on the multilayer polygonal models corresponds to which position provided on the height map, a position which is provided on the height map and corresponds to the position provided on the multilayer polygonal models; and a step (S16) of changing the height data value of the position provided on the height map.
Further, the object interfering step may include a circular region decreasing step (S16) of decreasing the height date values within a circular region having a predetermined radius and having its center at the position (Pc) which is provided on the height map and corresponds to the current position of the moving object (FIG. 17).
Further, the object interfering step may further include an outer region increasing step (S18) of increasing the height data values of a predetermined region outside the circular region in accordance with a decreasing amount of the height data values which is obtained in the circular region decreasing step (FIG. 20).
Further, the image processing program may further cause the computer to execute an operation data acquisition step of acquiring operation data from an input device (7). And the movement control step may include an object operation step of moving the moving object based on the operation data.
Further, the height changing step may include a random increasing step (S20) of randomly selecting a position provided on the height map and of increasing the height data value of the position (FIG. 15).
Further, the image processing program may cause the computer, based on the determination made in the visible region determining step that the region is to be displayed in a visible manner, to draw the region provided on the multilayer polygonal models by using a color and transparency set in advance with respect to each layer, in the drawing step.
Further, the image processing program may further cause the computer to execute a texture image reading step of reading a texture image from the storage means. And the drawing step may further include a texture image mapping step of mapping, with the texture image, the region based on the determination made in the visible region determining step that the region is to be displayed in a visible manner, so as to draw the region.
Further, the image processing program may further cause the computer to execute a step of reading, from the storage means (11e, 12), base model data (41) for constructing a base model which is a polygonal model based on which the multilayer polygonal models are constructed, and to execute a multilayer model generating step of generating the multilayer polygon data based on the read base model data.
Further, the image processing program may further cause the computer to execute a base model mapping step of texture-mapping the base model with a texture image (42) prepared for the base model.
Further, the image processing program may further cause the computer to execute a layer number changing step of changing the number of layers to be generated in the multilayer model generating step.
Further, the multilayer polygon data read in the polygon data reading step may be polygon data prepared in advance.
Further, the image processing program may further cause the computer, in a separate manner form the multilayer polygonal models constructed based on the multilayer polygon data read in the polygon data reading step, to execute a step of reading, from the storage means (11e, 12), base model data (41) for constructing a base model which is a polygonal model based on which the multilayer polygonal models are constructed, and to execute a base model mapping step of texture-mapping, with a texture image prepared for the base model, the base model constructed based on the read base model data.
An image processing apparatus according to certain example embodiments is an image processing apparatus (3) for drawing a three-dimensional object (e.g., an accumulation of snow, soil, sand, or bricks) positioned in a virtual space, and includes polygon data reading means (10, 11b), height map reading means (10, 11b), visible region determining means (10, 11b), and drawing means (10, 11b). The polygon data reading means is means for reading, from storage means (11e, 12), multilayer polygon data (43) for constructing multilayer polygonal models including a plurality of polygonal models positioned in layers. The height map reading means is means for reading, from the storage means (11e, 12), a height map (30) including height data values arranged in a two-dimensional array, the height data values each indicating a height of each position which is provided on the three-dimensional object to be drawn and corresponds to each position provided on the multilayer polygonal models. The visible region determining means is means for determining, by comparing a height of a layer of the multilayer polygonal models to the height data value of a position (texel) provided on the height map, whether a position provided on the layer and corresponding to the position provided on the height map is to be displayed in a visible manner. The drawing means is means for, based on a determination made by the visible region determining means that a region is to be displayed in a visible manner, drawing the region in a predetermined color.
Further, the image processing apparatus may further include height changing means (10, 11b) for changing the height data values of at least a portion of positions provided on the height map.
Further, the image processing apparatus may further include moving object positioning means (10, 11b) for positioning, in the virtual space, a moving object (31) which is an object different from the three-dimensional object, and also include movement control means (10 ,11b) for moving the moving object. And the height changing means may include object interfering means for changing the height data value of a position (Pc) which is provided on the height map and corresponds to a current position of the moving object.
In certain example embodiments, in three-dimensional image processing, it is possible to draw a three-dimensional object, such as an accumulation of snow, soil, sand, or bricks, positioned in a virtual space, using the small number of polygons even when the three-dimensional object is complex-shaped, by displaying the object in a simulated manner by multilayer polygonal models, without preparing a polygonal model in shape corresponding to the shape of the object.
These and other objects, features, aspects and advantages of certain example embodiments will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings.